package edu.gatech.cs2340.teamrocket.model.pokemon.ailments;

import edu.gatech.cs2340.teamrocket.model.pokemon.Pokemon;

/**
 * Represents a Freeze status ailment.
 *
 * @author Joe Tacheron
 */
public class Freeze implements Ailment {

    private double healProb;

    /**
     * Unable to move. 0% chance it will be healed on the first turn. Subsequent
     * turns have a 20% chance of heal.
     *
     * @param t
     * @return
     */
    @Override
    public String affect(Pokemon t) {
        if(Math.random() < healProb){
            t.setAilment(AilmentFactory.NONE);
            t.canMove(true);
            return healMessage(t);
        }
        healProb = 0.2;
        t.canMove(false);
        return null;
    }

    @Override
    public String catchMessage(Pokemon t) {
        return t + " is frozen solid!";
    }

    @Override
    public String healMessage(Pokemon t) {
        return t + " thawed out!";
    }

    @Override
    public String faintMessage(Pokemon t) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public String hurtMessage(Pokemon t) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    /**
     *
     * @return true
     */
    @Override
    public boolean healedByFullHeal() {
        return true;
    }

    /**
     *
     * @return "FRZ" colored blue
     */
    @Override
    public String statusString() {
        return "<span color='blue'>FRZ</span>";
    }
}
